package com.springcloud.myfeign.myfeign;

import com.fasterxml.jackson.databind.ObjectMapper;
import feign.Feign;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.support.SpringDecoder;
import org.springframework.cloud.openfeign.support.SpringEncoder;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

public class MyMain {
	public static void main(String[] args) {
		HttpMessageConverter jsonConverter = new MappingJackson2HttpMessageConverter(new ObjectMapper());
		ObjectFactory<HttpMessageConverters> converter = ()-> new HttpMessageConverters(jsonConverter);

		HelloWorldService target = Feign.builder()
				.encoder(new SpringEncoder(converter))
				.decoder(new SpringDecoder(converter))
				.target(HelloWorldService.class, "http://localhost:8778");
		//String hahahah = target.home("hahahah");
		//System.out.println(hahahah);
	}
}
